package com.xjscrm.console.web.group;

import com.xjscrm.console.param.BaseDto;
import com.xjscrm.console.param.group.AddWwGroupTagGroupDto;
import com.xjscrm.console.param.group.WwGroupTagDto;
import com.xjscrm.console.param.group.WwGroupTagRelDto;
import com.xjscrm.console.service.customer.group.WwGroupTagBatchService;
import com.xjscrm.console.service.customer.group.WwGroupTagService;
import com.xjscrm.console.vo.WwGroupTagsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(value = "客户群标签管理", tags = "客户群标签管理")
@RestController
@RequestMapping(value = "/wwGroupTag")
public class WwGroupTagController {

     @Autowired
     private WwGroupTagService wwGroupTagService;

     @Autowired
     private WwGroupTagBatchService wwGroupTagBatchService;

    @ApiOperation(value = "新增客户群标签组(可在新增标签组时，加入标签)", notes = "新增客户群标签组(可在新增标签组时，加入标签)",response = Boolean.class)
    @PostMapping(value ="/addWwGroupTagGroup" )
    public Object addWwGroupTagGroup(@RequestBody AddWwGroupTagGroupDto addWwGroupTagGroupDto)throws Exception{
        wwGroupTagService.addWwGroupTagGroup(addWwGroupTagGroupDto);
        return true;
    }

    @ApiOperation(value = "新增客户群标签", notes = "新增客户群标签",response = Boolean.class)
    @PostMapping(value ="/addWwGroupTag" )
    public Object addWwGroupTag(@RequestBody WwGroupTagDto wwGroupTagDto)throws Exception{
        wwGroupTagService.addWwGroupTag(wwGroupTagDto);
        return true;
    }

    @ApiOperation(value = "删除客户群标签", notes = "删除客户群标签",response = Boolean.class)
    @PostMapping(value ="/deleWwGroupTag" )
    public Object deleWwGroupTag(@RequestBody WwGroupTagDto wwGroupTagDto)throws Exception{
        wwGroupTagService.deleWwGroupTag(wwGroupTagDto);
        return true;
    }

    @ApiOperation(value = "修改客户群标签", notes = "修改客户群标签",response = Boolean.class)
    @PostMapping(value ="/updateWwGroupTag" )
    public Object updateWwGroupTag(@RequestBody WwGroupTagDto wwGroupTagDto )throws Exception{
        wwGroupTagService.updateWwGroupTag(wwGroupTagDto);
        return true;
    }

    @ApiOperation(value = "获取客户群标签树", notes = "获取客户群标签树",response = Map.class)
    @PostMapping(value ="/getWwGroupTagTree" )
    public Object getWwGroupTagTree(@RequestBody BaseDto baseDto)throws Exception{
        return  wwGroupTagService.getWwGroupTagTree(baseDto);
    }

    @ApiOperation(value = "获取标签详情", notes = "获取标签详情",response = WwGroupTagsVo.class)
    @PostMapping(value ="/getWwGroupTagDetail" )
    public Object getWwGroupTagDetail(@RequestBody WwGroupTagDto wwGroupTagDto)throws Exception{
        return wwGroupTagService.getWwGroupTagDetail(wwGroupTagDto);
    }


    @ApiOperation(value = "批量新增客户群和群标签关系", notes = "批量新增客户群和群标签关系",response = Boolean.class)
    @PostMapping(value ="/BatchAddWwGroupTagRel" )
    public Object BatchAddWwGroupTagRel(@RequestBody WwGroupTagRelDto wwGroupTagRelDto)throws Exception{
        wwGroupTagBatchService.BatchAddWwGroupTagRel(wwGroupTagRelDto);
        return true;
    }

    @ApiOperation(value = "批量删除客户群和群标签关系", notes = "批量删除客户群和群标签关系",response = Boolean.class)
    @PostMapping(value ="/BatchDeleWwGroupTagRel" )
    public Object BatchDeleWwGroupTagRel(@RequestBody WwGroupTagRelDto wwGroupTagRelDto)throws Exception{
        wwGroupTagBatchService.BatchDeleWwGroupTagRel(wwGroupTagRelDto);
        return true;
    }


    @ApiOperation(value = "批量移动客户群和群标签关系", notes = "批量移动客户群和群标签关系",response = Boolean.class)
    @PostMapping(value ="/BatchMoveWwGroupTagRel" )
    public Object BatchMoveWwGroupTagRel(@RequestBody WwGroupTagRelDto wwGroupTagRelDto)throws Exception{
        wwGroupTagBatchService.BatchMoveWwGroupTagRel(wwGroupTagRelDto);
        return true;
    }

}
